<!doctype html>
<html>
  <title>Discovery</title>
  <script src="/lib/webintents.debug.js"></script>
  <script src="/lib/events.js"></script>
  <script>

    attachEventListener(window, "load", function() {
      var use = document.getElementById("use");
      attachEventListener(use, "click", function() {
        if(!!window.intent) {
          var data = [
            { 
              action: "http://example.com/purchase",
              title: "A New type of Purchase intent"
            },
            {
              action: "http://example.com/book",
              title: "A way to book a resource such as a table, or ticket"
            }
          ];
          window.intent.postResult(data);
          setTimeout(function() { window.close();}, 500);
        }      

    });
   }, false);   

  </script>
  <body>
    <h2>Code</h2>
    <button id="use">Use</button>
    <pre>
</pre>
  </body>
</html>
